<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 对象数组去重
    let arr = [
        {name: 'jack', age: 20},
        {name: 'rose', age: 20},
        {name: 'lily', age: 20},
        {name: 'jack', age: 20},
    ];

    // 定义去重数组
    // arr = arr.filter((el, index) => arr.map(el => el.name).indexOf(el.name) == index);
    arr = arr.filter((el, index) => arr.map(el => JSON.stringify(el)).indexOf(JSON.stringify(el)) == index);
    console.log(arr);
</script>
</html>